<template>
  <div id="registry">
    
  <div class="whole">
    <div class="header">
      <div class="header-left">
        <a href="#" class="logo">
          <div class="header-logo"></div>
        </a>

        <div class="logo-right">欢迎注册</div>
      </div>
      <div class="aaa">
        <a href="/login" class="header-right">我已经注册，马上登录></a>
      </div>
    </div>

    <div class="middle">
      <div class="middle-son">
        <div class="middle-three">
          <div class="middle-gift">
            <div class="two-logo"></div>
            注册领<em>199</em>元大礼包
          </div>
          <div class="phone">
            <label class="phone-number"> 手机号码</label>
            <input
              class="phone-text"
              type="text"
              placeholder="建议使用常用的手机号"
            />
            <!-- <span class="error-msg">错误信息提示</span> -->
          </div>

          <div class="phone">
            <label class="phone-verify"> 手机验证码</label>
            <input
              class="verify-text"
              type="text"
              placeholder="请输入手机验证码"
            />
            <a href="#" class="verify-number">获取短信验证码</a>
            <!-- <span class="error-msg">错误信息提示</span> -->
          </div>

          <div class="phone">
            <label class="pass"> 设置密码</label>
            <input class="password" type="text" placeholder="请输入密码" />
            <!-- <span class="error-msg">错误信息提示</span> -->
          </div>

          <a href="/login"><div class="btn">提交注册</div></a>
        </div>
      </div>
    </div>
  </div>
  </div>
</template>

<script>

export default {
  name: 'ZRegister',
  data() {
    return {
      Register: {
        phone: '',
        userName: '',
        password: '',
        reqpassword: '',
        code: '',
        userPhone: '',
        userCode: '',
        phoneNumber: '',
      },
      //验证手机号码
      isaShow: false,
      // 校验用户名状态
      isShow: false,
    }
  },

  methods: {
    changeUserName() {
      if (this.Register.userName === '') {
        return (this.isShow = true)
      } else {
        return (this.isShow = false)
      }
    },
    // 定义的方法，应该定义在methods里
    userPhone() {
      const reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/
      if (this.Register.userPhone === '' || this.Register.userPhone.length <= 10 || !reg.test(this.Register.userPhone)) {
        console.log('错误')
        return (this.isaShow = false)
      } else {
        console.log('正确')
        return this.userPhone
      }
    }
  }
}
</script>
<style lang="less" scoped>
* {
  margin: 0px;
  padding: 0px;
  list-style: none;
  text-decoration: none;
}
body {
  background-color: #f8f8f8;
}

#registry {
  width: 990px;
  margin: 0 auto;
  // margin-bottom: 40px;
}

.whole {
  background-color: #f8f8f8;
}
.header {
  margin: 0 auto;
  width: 990px;
  height: 88px;
}
.header .header-logo {
  float: left;
  width: 190px;
  height: 50px;
  margin-right: 24px;
  background: url(./images/sprite.png) no-repeat;
  background-size: 190px 110px;
}
.header .aaa .header-right:hover {
  color: #f40;
}
.logo-right {
  float: left;
  font-size: 18px;
  color: #666;
  line-height: 88px;
}
.header .header-right {
  float: right;
  margin-top: 63px;
  text-decoration: none;
}
.middle {
  margin: 0 auto;
  width: 990px;
  border: 1px solid #ddd;
  border-top: 3px solid #f90;
  background: #fff;
  padding: 55px 0;
  line-height: 1.5;
}
#registry form {
  width: 380px;
  margin: 0 auto;
}

#registry button {
  width: 148px;
  height: 40px;
  line-height: 38px;
  text-align: center;
  background: #f5f5f5;
  border: 1px solid #bbb;
  font-size: 14px;
  margin: -1px -1px 0 0;
  padding: 1px;
  position: absolute;
  right: 0;
  top: 0;
}
#registry #yanzheng {
  width: 150px;
}

footer {
  width: 100%;
  height: 579px;
  overflow: hidden;
}


.middle-three {
  width: 388px;
  height: 327px;
  margin: 0px 305px;
}
.middle-gift {
  font-size: 14px;
  line-height: 17px;
  padding-left: 2px;
  margin-bottom: 17px;
}
.two-logo {
  float: left;
  width: 19px;
  height: 17px;
  margin-right: 6px;
  background: url(./images/sprite.png) -75px -93px no-repeat;
}
.middle-three em {
  color: #f40;
}
.phone {
  border: 1px solid #ccc;
  margin-bottom: 30px;
  /* float: left;
  width: 76px;
  padding-left: 11px; */
}
.phone input {
  outline: none;
  border: none;
}
.phone-number {
  width: 87px;
  height: 38px;
  padding-left: 11px;
  padding-right: 15px;
}
.phone-text {
  width: 291px;
  height: 38px;
  font: 12px;
  color: #cacaca;
  top: 0;
  left: 0;
  cursor: text;
}
.phone-verify {
  width: 87px;
  height: 38px;
  font: 12px;
  padding-left: 11px;
  padding-right: 10px;
}
.verify-text {
  width: 142px;
  height: 38px;
  font: 12px;
}
.verify-number {
  width: 150px;
  height: 40px;
  color: #333;
  font: 14px;
  background: #f5f5f5;
  /* border: 1px solid #bbb; */
  margin: -1px -1px 0px 0px;
  text-decoration: none;
}
.phone .verify-number:hover {
  color: #f40;
}
.pass {
  width: 87px;
  height: 38px;
  font: 12px;
  padding-left: 11px;
  padding-right: 15px;
}
.password {
  width: 291;
  height: 38px;
  font: 12px;
  color: #cacaca;
}
.btn {
  width: 380px;
  height: 40px;
  color: #fff;
  font: 20px;
  background: #ff6600;
  margin: 24px 0px 5px;
  text-align: center;
  line-height: 40px;
}
</style>
